Skip to main content

GatherBy

GatherBy[list,f] gathers into sublists each set of elements in list that gives the same value when f is applied.

GatherBy[list,{f1,f2,…}] gathers list into nested sublists using fi at level i.

Please visit the official Wolfram Language Reference for more details and examples on core symbols.